Skip to content

Move Hash specs to rely less on shared examples#1367

Open
Earlopain wants to merge 1 commit into
ruby:masterfrom
Earlopain:hash-aliases
Open

Move Hash specs to rely less on shared examples#1367
Earlopain wants to merge 1 commit into
ruby:masterfrom
Earlopain:hash-aliases

Conversation

@Earlopain
Copy link
Copy Markdown
Contributor

See #1364

This is mostly a mechanical translation. A few things of interest:

Two shared specs weren't actually shared. Hash#index used to be an alias for Hash#key but was removed at some point. Hash#values_at had shared specs which never were actually shared.

Tests for Hash#[]= used send. I explicitly added back a test usign send to assert the return value.

I cleaned up requires, each test file can be run in isolation.

For ../mspec/bin/mspec core/hash:

Before:
69 files, 633 examples, 1176 expectations, 0 failures, 0 errors, 0 tagged

After:
69 files, 558 examples, 1026 expectations, 0 failures, 0 errors, 0 tagged

So 75 fewer specs, 150 fewer assertions

This is mostly a mechanical translation. A few things of interest:

Two shared specs weren't actually shared. `Hash#index` used to be an alias for `Hash#key` but was removed at some point. `Hash#values_at` had shared specs which never were actually shared.

Tests for `Hash#[]=` used `send`. I explicitly added back a test usign `send` to assert the return value.

I cleaned up requires, each test file can be run in isolation.

For `../mspec/bin/mspec core/hash`:

```
Before:
69 files, 633 examples, 1176 expectations, 0 failures, 0 errors, 0 tagged

After:
69 files, 558 examples, 1026 expectations, 0 failures, 0 errors, 0 tagged
```

So 75 fewer specs, 150 fewer assertions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant